package ExceptionTest.Test1_1;

public class Student {
    private String name;
    private int age;

    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        if(age < 0 || age > 120)
        {
            throw new IllegalArgumentException("年龄不合法");
        }
        this.age = age;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
